Learning Ansible 2.7 by Fabio Alessandro Locati
Author:Fabio Alessandro Locati
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2019-04-30T16:46:48+00:00
If you declared an entry for your public zone but not in the private one, the machines in the VPC will not be able to resolve that entry.
After you have created the public zone, AWS will give you a few name server IP addresses and you need to put those in your register/root zone DNS so that you can actually resolve those DNS.
Simple AWS deployment
As we said previously, the first thing that we will need is the networking up. For this example, we will need just one single network in one AZ and all our machines will stay there.
In this section, we will be working in the playbooks/aws_simple_provision.yaml file.
The first two lines are just used to declare the host that will perform the commands (localhost) and the beginning of the tasks section:
- hosts: localhost tasks:
First, we are going to ensure that the public/private key pair is present:
- name: Ensure key pair is present
ec2_key:
name: fale
key_material: "{{ lookup('file', '~/.ssh/fale.pub') }}"
In AWS, we need to have a VPC network and subnetwork. By default, they are already there, but if you need it, you can do the following to create the VPC network:
- name: Ensure VPC network is present ec2_vpc_net: name: NET_NAME state: present cidr_block: 10.0.0.0/16 region: AWS_REGION register: aws_net - name: Ensure the VPC subnetwork is present ec2_vpc_subnet: state: present az: AWS_AZ vpc_id: '{{ aws_simple_net.vpc_id }}' cidr: 10.0.1.0/24 register: aws_subnet
Since we are using the default VPC, we need to query AWS to know the VPC network and subnetwork values:
- name: Ensure key pair is present
ec2_key:
name: fale
key_material: "{{ lookup('file', '~/.ssh/fale.pub') }}"
- name: Gather information of the EC2 VPC net in eu-west-1
ec2_vpc_net_facts:
region: eu-west-1
register: aws_simple_net
- name: Gather information of the EC2 VPC subnet in eu-west-1
ec2_vpc_subnet_facts:
region: eu-west-1
filters:
vpc-id: '{{ aws_simple_net.vpcs.0.id }}'
register: aws_simple_subnet
Now we have all the information we need on the network and subnetwork, we can move to security groups. We can do this with the ec2_group module. In the AWS world, security groups are used for firewalling. Security groups are very similar to groups of firewall rules that share the same destination (for ingress rules) or the same destination (for egress rules). Three differences with standard firewalls rules are actually worth mentioning:
Multiple security groups can be applied to the same EC2 instance.
As a source (for ingress rules) or destination (for egress rules), you can specify one of the following: An instance ID
Another security group
An IP range
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Anatomy | Animals |
Bacteriology | Biochemistry |
Bioelectricity | Bioinformatics |
Biology | Biophysics |
Biotechnology | Botany |
Ecology | Genetics |
Paleontology | Plants |
Taxonomic Classification | Zoology |
Sapiens: A Brief History of Humankind by Yuval Noah Harari(13926)
The Tidewater Tales by John Barth(12375)
Mastermind: How to Think Like Sherlock Holmes by Maria Konnikova(6899)
Do No Harm Stories of Life, Death and Brain Surgery by Henry Marsh(6662)
The Thirst by Nesbo Jo(6413)
Why We Sleep: Unlocking the Power of Sleep and Dreams by Matthew Walker(6310)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5153)
Sapiens by Yuval Noah Harari(5096)
The Longevity Diet by Valter Longo(4838)
The Body: A Guide for Occupants by Bill Bryson(4543)
The Rules Do Not Apply by Ariel Levy(4493)
The Immortal Life of Henrietta Lacks by Rebecca Skloot(4228)
Why We Sleep by Matthew Walker(4174)
Animal Frequency by Melissa Alvarez(4128)
Yoga Anatomy by Kaminoff Leslie(4087)
The Hacking of the American Mind by Robert H. Lustig(4055)
All Creatures Great and Small by James Herriot(3956)
Barron's AP Biology by Goldberg M.S. Deborah T(3927)
Double Down (Diary of a Wimpy Kid Book 11) by Jeff Kinney(3881)
